Dynamics AX identifies its releases with two version
numbers— kernel version and application version. For example,
version number 5.0.593.0 means Dynamics AX 2009 RTM and 5.0.1000.52 is
Dynamics AX 2009 Service Pack 1. Dynamics AX hotfix rollups are
presented in a similar way by only updating the last version number
digits. Version numbers an be viewed in the About Microsoft Dynamics AX dialog, which can be accessed from the Help menu.
Besides standard
versioning, Dynamics AX allows adding additional versions for solution
developers to control their releases. In this recipe, we will learn how
to do that. We will modify standard application objects to incorporate
our changes.
Getting ready
Solution versions can
be changed only in SL1, SL2, SL3, BUS (and BUP) layers. SL1-SL3 layers
are used for certified solutions and BUS— for business partner
solutions. To proceed further, we will need the BUS layer code in order
to log in to the BUS and BUP layers of the application.
How to do it...
1. Log in to the BUS layer, and modify sLxAppl() of the ApplicationVersion class to:
private static client str sLxAppl()
{
return '1.0.0';
}
2. Log in to the BUP layer, and modify the same method to:
private static client str sLxAppl()
{
return '2.0.0';
}
3. The class in AOT should look like this:
4. Open Help | About Microsoft Dynamics AX, and notice the Solution version numbers:
How it works...
The ApplicationVersion class is the place where application version numbers are stored. For example, applBuildNo()
returns the current application version. By modifying this class,
Dynamics AX developers can modify original or custom version numbers.
Later this class is called from the SysAbout form, which is actually the About Microsoft Dynamics AX dialog.
The class already contains a special method sLxAppl(),
which should be used when defining a custom solution version. The
interesting point is that different version numbers can be stored in
different layers. In our example, first we set a version in BUS, and
then we change that version in the BUP layer. And the result is that we
can see both numbers separated by a slash in the About Microsoft Dynamics AX dialog. The text Solution version is added automatically, though it could be also changed.
There's more...
Every
Dynamics AX implementation project contains more or less
customer-specific changes. Regardless of how big the modifications are,
it is a good practice to use versioning. The modifications are normally
stored in the VAR layer or any layer above it and are not included in
automatic version display. However, if we look at the of the SysAbout
form, we could notice that the information displayed on this form is
actually formatted here. We can add our own code and relevant control to
the form itself to display the custom name and version. So let's
improve previous example and add an additional version called VAR version. run()
To follow existing practice, let's add one more method in the ApplicationVersion class first. (Do not forget to logout of BUP layer and log into your working layer). It will hold our version number:
static str varAppl()
{
return '3.0.0';
}
In AOT, open SysAbout form and add a new StaticText control for displaying version-related information with the following properties:
Property
|
Value
|
---|
Name
|
VARVersion
|
AutoDeclaration
|
Yes
|
Width
|
Column width
|
BackStyle
|
Transparent
|
Text
| |
The form in AOT should look like following:
And finally, we modify the form's run(). Let's add:
str varVersionNumber = ApplicationVersion::varAppl();
right after:
str slxVersionNumber = ApplicationVersion::sLxApplAll();
and:
if (varVersionNumber)
{
VARVersion.text('VAR version: ' + varVersionNumber);
}
right after:
if (slxVersionNumber)
application versionapplication versionworking{
solutionVersion.text('Solution version: ' +
slxVersionNumber);
}
Now, open Help | About Microsoft Dynamics AX again, and notice a new entry— VAR version:
In this way, you can customize the display of the About Microsoft Dynamics AX dialog to ensure that any custom modification or module is listed here along with its version for user information.